// 回到顶部
// 获取元素
const tops=document.querySelector(".top");
// 添加窗口事件
window.addEventListener("scroll",function(){
    if(scrollY>=1000){
        tops.style.display="block"
    }else{tops.style.display="none"}
});
// 添加点击事件
let timeID
tops.addEventListener("click",function(){
    window.clearInterval(timeID);
    timeID=window.setInterval(function(){
        let re=scrollY;
         re=re-10;
         window.scrollTo(0,re);
        if(re<=0){
            window.scrollTo(0,0);
            window.clearInterval(timeID);
         }
     },1);
});


// 注册页面=============================================
// 获取元素
 const register=document.querySelector(".register");
 const headeEnter=document.querySelectorAll(".heade-enter a");
 headeEnter[1].addEventListener("click",function(){
     registers.style.display="block"
 });



// 添加点击事件
// 获取元素
const registers=document.querySelector("#register");
const formBack=document.querySelector(".form-back");
registers.addEventListener("click",function(){
    registers.style.display="none"
});
formBack.addEventListener("click",function(e){
  e.stopPropagation();
});
// 获取验证码
// 获取元素
const authCode=document.querySelector("#register .form-back p span");
const authCodeTime=document.querySelector("#register .form-back p a");
authCode.addEventListener("click",function(){
    authCode.style.display="none";
    let re=6;
    let timeID= window.setInterval(function(){
        re--;
        authCodeTime.innerText=re;
        if(re<=0){
            window.clearInterval(timeID);
            authCode.style.display="block";
            authCodeTime.innerText=6;
        }
    },1000)
})